<?php 

/**
 * Joomla! 1.5 component arts_curriculum
 * @package    arts_curriculum
 * @subpackage
 * @author     Chris Borkowski {@link http://www.guggenheim.org}
 * @author     Created on 31-August-2009
 * @author     Modified on 22-January-2010
 */

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' ); 

function taskMessage(){
$task =& JFactory::getURI();
$message = $task->getVar('task', 'No task found in URI', 'post','string');
return $message;
}
?>

<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>

<div id="ac_category_page_box">
  
  <div id="ac_category_page_title">
    <!--title gets a fold after the ":" -->
    <h2><?php echo $this->items[0]->CATlink;?></h2>
  </div>
  
   <!-- the rest of the category view when no task string if found in the URI -->
  <?php if (taskMessage() == 'No task found in URI') :?>
  <div id="ac_category_page_description_above_fold">
    <!-- now for the 1st big trick -->
    <p><?php echo preg_replace('/{ac-break}(.*)|(\n)(.*){1,}/', '', $this->category->description); ?></p>
  </div>
  
  	<div id="ac_category_page_lessons_sub"><h4>Themes</h4></div>
  	
  	<div id="ac_category_page_lessons_box"><!-- start ac_category_page_lessons_box" -->
    
    <?php foreach ($this->items as $item) : ?>
    
	<div class="ac_category_lesson_box_<?php echo $item->odd + 1; ?>"><!--count me -->
    	<div class="ac_cat_lesson_img"><a href="<?php echo $item->imagelink; ?>"><img src="/images/content/arts_curriculum/derivative1/<?php echo $item->crop; ?>" alt="<?php echo $item->title; ?>" /></a></div>
      		<table id="push">
      			<tr><td style="vertical-align:top"><?php echo $item->link; ?></td><tr>
      			<tr><td style="vertical-align:bottom">
      			<!--push down please-->
        		<?php echo $item->subjectlinks; ?>   
				</td></tr>
   			</table>
    	</div><!--end ac_category_lesson_box -->
    
    <?php endforeach; ?>
  	</div><!-- end ac_category_page_lessons_box" -->
  
  	<div id="ac_category_page_description_below_fold">
    <!-- now for the 2nd big trick..ta da ! the description is cut in half, thank you, I'll be here all week  -->
    <?php echo preg_replace('/(.*){ac-break}/', '', $this->category->description); ?> 
    </div>
    
    
   
    <!-- we are adding a php if clause to fire in the vocabulary and related terms when called by the URI task string -->
  	
			<?php elseif (taskMessage() == "additional") :?>
			<div id="ac_category_addtional_box">
			<!-- now for the 3rd big trick -->
				<?php if( $this->category->v_ad_title) : ?>
				<div id="ac_category_addtional_title"><h4><?php echo $this->category->v_ad_title; ?></h4>
				<?php endif ;?>
				</div>
			<p><?php echo $this->category->v_add ; ?></p>
			</div>
		  
			<?php elseif (taskMessage() == 'vocabulary') :?>
			<div id="ac_category_vocabulary_box">
			<!-- now for the 4th big trick -->
			<div id="ac_category_vocabulary_title"><h4>Vocabulary</h4></div>
			<div class="ac_category_vocabulary_title_inner"><p><?php echo $this->category->v_main_body ; ?></p><div>
			</div>
			<?php endif ;?>

</div><!--end ac page box-->

	</td>
</tr>
</table>

